<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">任务编号</td><td id="number" class="tv"></td><td class="tt">任务名称</td><td id="name" class="tv"></td></tr>
                <tr><td class="tt">任务类别</td><td id="type_name" class="tv"></td><td class="tt">关联项目</td><td id="enginid_name" class="colorlan tv"></td></tr>
                <tr><td class="tt">执行人</td><td id="zhier_name" class="tv"></td><td class="tt">优先级</td><td id="youxian" class="tv"></td></tr>
                <tr><td class="tt">计划开始时间</td><td id="planstartdt" class="tv"></td><td class="tt">计划结束时间</td><td id="planenddt" class="tv"></td></tr>
                <tr><td class="tt">任务描述</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">任务执行</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">任务状态</td><td id="status_name" class="tv"></td><td class="tt">完成比例</td><td id="rate" class="tv"></td></tr>
                <tr><td class="tt">实际开始时间</td><td id="startdt" class="tv"></td><td class="tt">实际完成时间</td><td id="enddt" class="tv"></td></tr>
                <tr><td class="tt">任务执行说明</td><td id="explainzhi" class="explain_huan tv" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div class="table-box tablenes">
            <div class="title">关联信息</div>
            <table class="layui-table">
                <tbody>
                <tr>
                    <td class="tt">关联流程</td>
                    <td id="flowrelasInfo"></td>
                </tr>
                </tbody>
            </table>
        </div>



        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_task_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;


                $("#number").text(data.number);
                $("#name").text(data.name);
                $("#type_name").text(data.type_name);
                $("#zhier_name").text(data.zhier_name);
                $("#youxian").text(data.youxian);
                $("#planstartdt").text(data.planstartdt);
                $("#planenddt").text(data.planenddt);
                $("#explain").text(data.explain);

                $("#status_name").text(data.status_name);
                if(data.rate){
                    $("#rate").text(data.rate+' %');
                }
                $("#startdt").text(data.startdt);
                $("#enddt").text(data.enddt);
                $("#explainzhi").text(data.explainzhi);


                if(data.enginid > 0){
                    $("#enginid_name").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }
                if(data.bidid > 0){
                    $("#enginid_name").text(engininfo.name).click(function () {
                        openPage('../bid_pool/show.php?id='+engininfo.id);
                    });
                }

                var flowrelas_str = '';
                let flowrelas = data.flowrelas_info;
                for (let i=0; i<flowrelas.length; i++){
                    if(flowrelas_str){
                        flowrelas_str += '<span class="colorlan" onclick="openPage(\'../'+flowrelas[i].modenum+'/show.php?id='+flowrelas[i].mid+'\')">';
                        flowrelas_str += '，'+flowrelas[i].modename+'('+flowrelas[i].sericnum+')';
                        flowrelas_str += '</span>';
                    }else{
                        flowrelas_str += '<span class="colorlan" onclick="openPage(\'../'+flowrelas[i].modenum+'/show.php?id='+flowrelas[i].mid+'\')">';
                        flowrelas_str += flowrelas[i].modename+'('+flowrelas[i].sericnum+')';
                        flowrelas_str += '</span>';
                    }
                }
                $('#flowrelasInfo').html(flowrelas_str);


                // $(".pageshowtitle").text('任务');

                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('task', param_id);
        showpage_dropopt();
    });



</script>
</body>
</html>




